LogMsg Subroutine

public subroutine LogMsg(unit, level, process, comment, argument)

write a formatted string on specified unit- It is called by Catch routine

Arguments

Type IntentOptional Attributes Name
integer(kind=short), intent(in) :: unit
character(len=*), intent(in) :: level

log level: info, warning, error

character(len=*), intent(in) :: process

process which puts log

character(len=*), intent(in) :: comment

comment on log

character(len=*), intent(in), optional :: argument

optional argument


Variables

Type Visibility Attributes Name Initial
character(len=3), public :: sep

Source Code

SUBROUTINE LogMsg &
!
(unit, level, process, comment, argument)

IMPLICIT NONE

! Subroutine arguments 
! Scalar arguments with intent(in):
INTEGER	(KIND = short), INTENT(in) :: unit
CHARACTER (LEN = *), INTENT(in) :: level !! log level: info, warning, error
CHARACTER (LEN = *), INTENT(in) :: process !! process which puts log
CHARACTER (LEN = *), INTENT(in) :: comment !! comment on log
CHARACTER (LEN = *), INTENT(in), OPTIONAL :: argument !! optional argument
! Local scalars:
CHARACTER (LEN = 3) :: sep
!------------end of declaration------------------------------------------------
         
CALL TimeStamp (unit)

sep = ' '//logsep//' '
WRITE (unit,'(a)', ADVANCE = "no") sep
WRITE (unit,'(a)', ADVANCE = "no") level
WRITE (unit,'(a)', ADVANCE = "no") sep
WRITE (unit,'(a)', ADVANCE = "no") process 
IF ( PRESENT (argument) ) THEN
	WRITE (unit,'(a)', ADVANCE = "no") sep
	WRITE (unit,'(a)', ADVANCE = "no") comment 
	WRITE (unit,'(a)') TRIM(argument )
ELSE
	WRITE (unit,'(a)', ADVANCE = "no") sep
	WRITE (unit,'(a)') comment
ENDIF

END SUBROUTINE LogMsg